#
# Makefile: library make file
#
# CopyRight (c) ACLINK
#
# Revision:
#    2010-07-14: zhousw create
#

TARGET  = liboal.a
SUBDIRS = src test

TEST_TARGET = oaltest
include base.mk

LIBS    = src/oal.a

$(TARGET): $(LIBS)
	@echo "============================================"
	@echo "|  create library $@"
	@echo "============================================"
# create $(TARGET)
	@$(AR) -q $@ $(filter %.o, $^)
# add $(LIBS) to $(TARGET)
	@echo OPEN $@ > $@.mklib
	@$(foreach i, $(filter %.a, $^), echo ADDLIB $(i) >> $@.mklib;)
	@echo SAVE >> $@.mklib
	@echo END >> $@.mklib
	@$(AR) -M < $@.mklib
	@$(RM) $@.mklib

.PHONY: test

test:$(TEST_TARGET) 
$(TEST_TARGET): $(TARGET) $(LIBS)
	$(CC) test/oaltest.a $(TARGET) -lpthread -o $@ 
# EOF
